#if !defined(_FPTMEMOFILE_H__INCLUDED_)
#define _FPTMEMOFILE_H__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "MemoFile.h"

// CFPTMemoFile - a Memo File

class TDBFUTILITY_IMPEXP CFPTMemoFile : public CMemoFile
{

	DECLARE_DYNAMIC(CFPTMemoFile)

// Constructors
public:
	CFPTMemoFile();

public:
	FPT_HEAD	m_FPTHead;

public:
	~CFPTMemoFile();

	BOOL Open(LPCTSTR lpszName, UINT nOpenFlag);
	void Close();

	virtual UINT GetMemoFileType();

	virtual BOOL ReadMemoRecord(DBF_ULONG lOffsetRec, DBF_LONG& nLen, CTDbfString& strMemo); 
	virtual BOOL ReadMemoRecord(DBF_ULONG lOffsetRec, DBF_LONG& nLen, unsigned char** pMemoData);

	virtual BOOL WriteMemoRecord(DBF_ULONG& lOffsetRec, DBF_LONG& nLen, CTDbfString& strMemo);

#ifdef _DEBUG
	virtual void AssertValid() const;
	virtual void Dump(CDumpContext& dc) const;
#endif


protected:
	BOOL ReadHeader();
	BOOL WriteHeader();

private:

	DBF_LONG AddMemoRecord(CTDbfString& strMemo);
	
	void UpdateMemoRecord(DBF_ULONG lOffsetRec, CTDbfString& strMemo);

	DBF_ULONG	m_nNextBlock;
	DBF_LONG	m_nBlockSize;
};

//{{AFX_INSERT_LOCATION}}
#endif // !defined(_FPTMEMOFILE_H__INCLUDED_)

